from toee import *
from scripts import *

def san_dialog( attachee, triggerer ):
	attachee.turn_towards(triggerer)
	if (not attachee.has_met(triggerer)):
		if (game.quests[35].state <= qs_accepted):
####		if (game.quests[34].state <= qs_accepted):
			triggerer.begin_dialog( attachee, 1 )
		else:
			triggerer.begin_dialog( attachee, 430 )
	elif (game.global_flags[75] == 1):
		triggerer.begin_dialog( attachee, 580 )
	elif (game.quests[35].state == qs_completed):
###	elif (game.quests[34].state == qs_completed):
		triggerer.begin_dialog( attachee, 790 )
	else:
		triggerer.begin_dialog( attachee, 700 )
	return SKIP_DEFAULT

def san_heartbeat( attachee, triggerer ):
	if (game.global_flags[877] == 1 and game.global_flags[880] == 0):
		zaxis = game.obj_create( 14639, location_from_axis (481L, 481L))
		zaxis.rotation = 1
		game.new_sid = 0
	return RUN_DEFAULT

def buttin( attachee, triggerer, line):
	npc = find_npc_near(attachee,8015)
	if (npc != OBJ_HANDLE_NULL):
		triggerer.begin_dialog(npc,line)
		npc.turn_towards(attachee)
		attachee.turn_towards(npc)
	else:
		triggerer.begin_dialog(attachee,760)
	return SKIP_DEFAULT